#rm websocket_client.o websocket_client
WEBRTCROOT=/media/luyao/video_send_back/webrtc
#WEBRTCOBJS=${WEBRTCROOT}/src/out/Debug/obj
WEBRTCOBJS=${WEBRTCROOT}/src/out/Release/obj

export CC=${WEBRTCROOT}/src/third_party/llvm-build/Release+Asserts/bin/clang
export CXX=${WEBRTCROOT}/src/third_party/llvm-build/Release+Asserts/bin/clang++

#cd ${WEBRTCOBJS}/buildtools/third_party/libc++/libc++ && ar -crv libwebrtc_c++.a *.o && mv libwebrtc_c++.a ${WEBRTCOBJS}/
#cd ${WEBRTCOBJS}/buildtools/third_party/libc++abi/libc++abi && ar -crv libwebrtc_c++abi.a *.o && mv libwebrtc_c++abi.a ${WEBRTCOBJS}/
exit

WEBRTCINCLUDE="-I${WEBRTCROOT}/src -I${WEBRTCROOT}/src/third_party/abseil-cpp -I${WEBRTCROOT}/src/third_party/jsoncpp/source/include  -I${WEBRTCROOT}/src/third_party/jsoncpp/generated -I${WEBRTCROOT}/src/third_party/libyuv/include -I${WEBRTCROOT}/src/buildtools/third_party/libc++/trunk/include -I${WEBRTCROOT}/src/third_party/llvm-build/Release+Asserts/lib/clang/9.0.0/include"

CMAKE_C_OUTPUT_EXTENSION=".o"
WEBRTJSONCPPCOBJS="${WEBRTCOBJS}/third_party/jsoncpp/jsoncpp/*${CMAKE_C_OUTPUT_EXTENSION}"
WEBRTTASK="${WEBRTCOBJS}/api/task_queue/default_task_queue_factory/*${CMAKE_C_OUTPUT_EXTENSION}"
WEBRTCEXTRAOBJS="${WEBRTJSONCPPCOBJS} ${WEBRTTASK} ${WEBRTCOBJS}/rtc_base/rtc_json/json${CMAKE_C_OUTPUT_EXTENSION}  ${WEBRTCOBJS}/rtc_base/rtc_task_queue_libevent/*${CMAKE_C_OUTPUT_EXTENSION} ${WEBRTCOBJS}/p2p/p2p_server_utils/stun_server.o ${WEBRTCOBJS}/test/platform_video_capturer/vcm_capturer.o ${WEBRTCOBJS}/test/video_test_common/test_video_capturer.o"

$CXX $WEBRTCINCLUDE -std=c++11 -fno-exceptions -fno-rtti -DWEBRTC_POSIX -DWEBRTC_LINUX -nostdinc++ \
     -isystem${WEBRTCROOT}/src/buildtools/third_party/libc++/trunk/include \
     -isystem${WEBRTCROOT}/src/buildtools/third_party/libc++abi/trunk/include \
     --sysroot=${WEBRTCROOT}/src/build/linux/debian_sid_amd64-sysroot \
     -Wall -Wno-unknown-pragmas -Wfatal-errors -Wno-unused-result \
     -c -o websocket_client.o websocket_client.cc

$CXX $WEBRTCINCLUDE -std=c++11 -fno-exceptions -fno-rtti -DWEBRTC_POSIX -DWEBRTC_LINUX -nostdinc++ \
     -isystem${WEBRTCROOT}/src/buildtools/third_party/libc++/trunk/include \
     -isystem${WEBRTCROOT}/src/buildtools/third_party/libc++abi/trunk/include \
     --sysroot=${WEBRTCROOT}/src/build/linux/debian_sid_amd64-sysroot \
     -Wall -Wno-unknown-pragmas -Wfatal-errors -Wno-unused-result \
     -c -o easywsclient.o easywsclient.cc

$CXX $WEBRTCINCLUDE -std=c++11 -fno-exceptions -fno-rtti -DWEBRTC_POSIX -DWEBRTC_LINUX -nostdinc++ \
     -isystem${WEBRTCROOT}/src/buildtools/third_party/libc++/trunk/include \
     -isystem${WEBRTCROOT}/src/buildtools/third_party/libc++abi/trunk/include \
     --sysroot=${WEBRTCROOT}/src/build/linux/debian_sid_amd64-sysroot \
     -Wall -Wno-pessimizing-move -Wno-unknown-pragmas -Wfatal-errors -Wno-unused-result \
     -c -o PeerConnectionManager.o conductor.cc

#export PKG_CONFIG_LIBDIR=/home/luyao/git/install_package/opencv-3.4.6/build_clang/install/usr/local/lib/pkgconfig
#echo `pkg-config --cflags --libs opencv`

$CXX $WEBRTCINCLUDE -std=c++11 -fno-exceptions -fno-rtti -DWEBRTC_POSIX -DWEBRTC_LINUX \
     -isystem${WEBRTCROOT}/src/buildtools/third_party/libc++/trunk/include \
     -isystem${WEBRTCROOT}/src/buildtools/third_party/libc++abi/trunk/include \
     --sysroot=${WEBRTCROOT}/src/build/linux/debian_sid_amd64-sysroot \
     -Wall -Wno-unknown-pragmas -Wfatal-errors -Wno-unused-result \
     PeerConnectionManager.o websocket_client.o easywsclient.o ${WEBRTCEXTRAOBJS} \
     -L${WEBRTCOBJS} -L${WEBRTCOBJS}/base/third_party/libevent -L${WEBRTCOBJS}/api \
     -lcreate_peerconnection_factory -levent -lpthread -lwebrtc -lm -ldl -lasound -lX11 -lwebrtc_c++ -lwebrtc_c++abi

